<?php

use yii\helpers\Html;
use yii\helpers\Url;
use kartik\grid\GridView;

/**
 * @var yii\web\View $this
 * @var yii\data\ActiveDataProvider $dataProvider
 * @var yiike\store\merchant\models\OrderGoodsSearch $searchModel
 */

$this->title = Yii::t('models', 'Order Goods');
$this->params['breadcrumbs'][] = $this->title;

if (isset($actionColumnTemplates)) {
    $actionColumnTemplate = implode(' ', $actionColumnTemplates);
    $actionColumnTemplateString = $actionColumnTemplate;
} else {
    Yii::$app->view->params['pageButtons'] = Html::a('<span class="glyphicon glyphicon-plus"></span> ' . 'New', ['create'], ['class' => 'btn btn-success']);
    $actionColumnTemplateString = "{view} {update} {delete}";
}
$actionColumnTemplateString = '<div class="action-buttons">'.$actionColumnTemplateString.'</div>';
?>
<style>
    .grouped-row {
        height: 40px;
        line-height: 40px;
        vertical-align: middle;
        font-weight: bold;
        background: #e1e1e8;
    }
</style>
<div class="box box-info giiant-crud order-goods-index">
    <div class="box-header with-border">
        <div class="box-title">
            <?= Yii::t('models', 'Order Goods') ?>
        </div>
    </div>
    <div class="box-body">
        <?php
        //             echo $this->render('_search', ['model' =>$searchModel]);
        ?>


        <?php \yii\widgets\Pjax::begin(['id'=>'pjax-main', 'enableReplaceState'=> false, 'linkSelector'=>'#pjax-main ul.pagination a, th a', 'clientOptions' => ['pjax:success'=>'function(){alert("yo")}']]) ?>


        <div class="clearfix crud-navigation">
            <div class="pull-left">
                <?= Html::a('<span class="glyphicon glyphicon-plus"></span> ' . '新增', ['create'], ['class' => 'btn btn-success']) ?>
            </div>

            <div class="pull-right">


                <?=
                \yii\bootstrap\ButtonDropdown::widget(
                    [
                        'id' => 'giiant-relations',
                        'encodeLabel' => false,
                        'label' => '<span class="glyphicon glyphicon-paperclip"></span> ' . '关联',
                        'dropdown' => [
                            'options' => [
                                'class' => 'dropdown-menu-right'
                            ],
                            'encodeLabels' => false,
                            'items' => [
                                [
                                    'url' => ['order/index'],
                                    'label' => '<i class="glyphicon glyphicon-arrow-left"></i> ' . Yii::t('models', 'Order'),
                                ],
                                [
                                    'url' => ['order/index'],
                                    'label' => '<i class="glyphicon glyphicon-arrow-left"></i> ' . Yii::t('models', 'Order'),
                                ],

                            ]
                        ],
                        'options' => [
                            'class' => 'btn-default'
                        ]
                    ]
                );
                ?>
            </div>
        </div>

        <hr />

        <div class="table-responsive">
            <?= GridView::widget([
                'dataProvider' => $dataProvider,
                'pager' => [
                    'class' => yii\widgets\LinkPager::className(),
                    'firstPageLabel' => 'First',
                    'lastPageLabel' => 'Last',
                ],
                'striped' => false,
//                'filterModel' => $searchModel,
                'tableOptions' => ['class' => 'table table-bordered table-hover'],
                'headerRowOptions' => ['class'=>'x'],
                'columns' => [
                    [
                        'attribute'=>'orderStore.trade_id',
                        'width'=>'310px',
                        'content'=>function ($model) {
                            return '订单号: '.$model->orderStore->trade_id. '&nbsp;&nbsp;&nbsp;&nbsp;合计: '.$model->price;
                        },
                        'group'=>true,
                        'groupedRow'=>true,
                        'groupOddCssClass'=>'grouped-row',
                        'groupEvenCssClass'=>'grouped-row',
                    ],
                    [
                        'attribute' => 'logo',
                        'content' => function ($model) {
                            return Html::img($model->logo, ['style' => 'max-width:70px;max-height:50px;']);
                        }
                    ],
                    'title',
                    'goods_sn',
                    'cost_price',
                    'num',
                    'spec',
                ],
            ]); ?>
        </div>
        <?php \yii\widgets\Pjax::end() ?>
    </div>
</div>




